<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>管理员登录</title>
    <script src="../js/jquery-2.2.3.min.js"></script>
    <script>
        function login(){
            alert("dianji");
            $.post("${pageContext.request.contextPath}/admin/logins",{"username":$("#username").val(),"password":$("#password").val()},function (resultMsg) {
                var span = $("#loginError");
                if (resultMsg.flag){
                    location.href="${pageContext.request.contextPath}/jsp/home.jsp";
                }else{
                    span.css("color","red");
                    span.html(resultMsg.errorMsg);
                }
            })
        }
    </script>
</head>
<body>
    <span id="loginError"></span><br>
    <form action="javascript:login();">
        用户名<input type="text" id="username" name="username"><br>
        密码<input type="password" id="password" name="password"><br>
        <input type="submit" value="登录">
    </form>
</body>
</html>
